package com.example.human_resource_management.config;

import com.example.human_resource_management.entry.po.Employee;

public class UserContext {
    private static final ThreadLocal<String> USER_ID = new ThreadLocal<>();
    private static final ThreadLocal<Long> EMP_ID = new ThreadLocal<>();
    private static final ThreadLocal<Employee> EMPLOYEE_INFO = new ThreadLocal<>();

    public static void setUserId(String userId) {
        USER_ID.set(userId);
    }

    public static String getUserId() {
        return USER_ID.get();
    }

    public static void setEmpId(Long empId) {
        EMP_ID.set(empId);
    }

    public static Long getEmpId() {
        return EMP_ID.get();
    }

    public static void setEmployeeInfo(Employee employee) {
        EMPLOYEE_INFO.set(employee);
    }

    public static Employee getEmployeeInfo() {
        return EMPLOYEE_INFO.get();
    }

    public static void clear() {
        USER_ID.remove();
        EMP_ID.remove();
        EMPLOYEE_INFO.remove();
    }
}